#!/usr/bin/env bash

set -e -u -x
source ./tasks/helpers.sh

mailpit_version="1.19.1"
mailpit_hash="e123cce9718cf91e68ac363934b5bcdce270d26398b223c29b1314b720867862"
if [ "$TARGETARCH" == "arm64" ]; then
  mailpit_hash="59764a3e6b3b5f0a0d1005c6115b1993c35c0431482ae4e2100682a60f7c5fd1"
fi

task_working_dir
download "https://github.com/axllent/mailpit/releases/download/v${mailpit_version}/mailpit-linux-${TARGETARCH}.tar.gz" "sha256" "$mailpit_hash"
extract_download "mailpit-linux-${TARGETARCH}.tar.gz"

install -D -m 755 "mailpit" "$TEST_INSTALL_PREFIX/bin/mailpit"

stamp
